<extend name="Public/base"/>

<block name="body">

	 <link href="__MOBILE__/css/list.css" rel="stylesheet">
	 <div class="container">
	 
	 	<div class="row">
	 		<ul class="nav nav-tabs">
		  <li role="presentation" class="<eq name="sort" value="create_time">active</eq>"><a href="{:U('Goods/cate',array('id'=>$cate['id'],'type'=>$type))}">默认</a></li>
		  <li role="presentation" class="<eq name="sort" value="volume">active</eq>"><a href="{:U('Goods/cate',array('id'=>$cate['id'],'sort'=>'volume','type'=>$type))}">销量</a></li>
		  <li role="presentation" class="<eq name="sort" value="price">active</eq>"><a href="{:U('Goods/cate',array('id'=>$cate['id'],'sort'=>'price','type'=>$type))}">价格</a></li>
		  <li role="presentation" class="<eq name="sort" value="hits">active</eq>"><a href="{:U('Goods/cate',array('id'=>$cate['id'],'sort'=>'hits','type'=>$type))}">浏览量</a></li>
		</ul>
	 	</div>
	 	<div class="row">
	 		<include file="Public:goods_list" />
	 	</div>
	 	
	 	<notempty name="_page">
    	 <div class="row">
				<div class="col-sm-12 ">
					<button id="next" class="btn" p="2" total-page="{$total_page}">
						点击加载更多
					</button>
				</div>
			
	      </div>
    </notempty>
      </div>	 
</block>
<block name="script">
<script type="text/javascript" src="__JS__/jquery.lazyload.min.js"></script>
<script>
	$(function(){
		  $('#next').click(function(){
		  	LoadPage();  
		  }); 
		  heightlight_bottom_nav("{:U('index')}"); 
		  $('.lazy').lazyload();
	});
	 
	function LoadPage(){
		var id="{$cate['id']}";
		var currentPage = $('#next').attr('p') ? $('#next').attr('p') : 1;
		$.get("{:U('Goods/cate')}",{'p':currentPage,'id':id},function(result){
			if(result.errno==0){
				$('.goods-list .list').append(result.content);
				$('#next').attr('p',result.p);
				if(result.p>$('#next').attr('total-page')){
					$('#next').html('木有了，亲');
					$('#next').attr('disabled',true);
					$('#next').addClass('disabled');
				}
			}
			
		},'json');	
	}
	</script>
</block>
